package com.my.structuraltype.mediator.computer;

public class MainBoard implements Mediator {

	private CDDriver driver;
	private CPU cpu;
	private VideoCard vcard;
	private SoundCard scard;
	
	@Override
	public void change(Colleague c) {
		if(c == driver) {
			System.out.println("driver -> mainboard");
			cpu.operation(((CDDriver) c).getData());
		} else if (c == cpu) {
			System.out.println("cpu -> mainboard");
			vcard.operation(((CPU) c).getVedioData());
			scard.operation(((CPU) c).getSoundData());
		}
	}
	
	/**
	 * @return the driver
	 */
	public CDDriver getDriver() {
		return driver;
	}

	/**
	 * @param driver the driver to set
	 */
	public void setDriver(CDDriver driver) {
		this.driver = driver;
	}

	/**
	 * @return the cpu
	 */
	public CPU getCpu() {
		return cpu;
	}

	/**
	 * @param cpu the cpu to set
	 */
	public void setCpu(CPU cpu) {
		this.cpu = cpu;
	}
	
	/**
	 * @return the vcard
	 */
	public VideoCard getVcard() {
		return vcard;
	}

	/**
	 * @param vcard the vcard to set
	 */
	public void setVcard(VideoCard vcard) {
		this.vcard = vcard;
	}

	/**
	 * @return the scard
	 */
	public SoundCard getScard() {
		return scard;
	}

	/**
	 * @param scard the scard to set
	 */
	public void setScard(SoundCard scard) {
		this.scard = scard;
	}

}
